import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import swimCorp.ReservationRemote;

public class Main {
	public static void main(String[] args) {
		try {
			Context jndiContext = new InitialContext();
			Object ref = jndiContext.lookup("Reservation/remote");
			ReservationRemote r = (ReservationRemote) ref;

			r.initDb();
			System.out.println("Ships:");
			for(String name: r.getShipNames()) {
				System.out.println(name);
			}

			System.out.println("Marco polo registration " +r.getShipWithName("Marco Polo").getRegistrationName());
		} catch (NamingException e) {
			e.printStackTrace();
		}
	}
}